package com.XiaoLongGroup.webtech.utils;/**
 * @author : SLCcccc
 * @date : 2023/5/7 22:15
 */

import java.util.HashMap;
import java.util.Map;

/**
 *@ClassName PageManage
 *@Description TODO 返回给前端的结果 用于表格渲染
 *@Author SLCcccc
 *@Date 2023/5/7 22:15
 *@Version 1.0
 */
public class PageManage {
    private static final String CODE = "code";
    private static final String MSG = "msg";
    private static final String COUNT = "count";
    private static final String DATA = "data";

    public static Map<String,Object> buildPage(Page page){
        Map<String, Object> map = new HashMap<>(4);
        map.put(PageManage.CODE, 0);
        map.put(PageManage.MSG, "");
        map.put(PageManage.COUNT, page.getTotal());
        map.put(PageManage.DATA, page.getRows());
        return map;
    }
}
